Add fn load_workspace_into_db
variant for ra_ap_load_cargo
's fn load_workspace
#20144
+25
−8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See code comment for motivation:
Specific use case motivating this change:
ra_ap_project_model
's flavor of metadata is not as rich ascargo_metadata
'sMetadata
, so a third-party may want to extendRootDatabase
with the metadata fromcargo_metadata
, but without having to first load the entire project (i.e. its entire source code and all). Instead it would be preferable to be able to defer loading viara_ap_load_cargo
until aftercargo_metadata
has been loaded (and most importantly: already been made use of).Imagine a tool that first performs package/target/crate discovery via
cargo_metadata
, then shows an overview of the project at hand, allowing for selecting individual items of interest and only upon confirmation does the actual heavy lifting of loading the project workspace viara_ap_load_cargo
. The current API would require one to create a temporary database for loading thecargo_metadata
stuff to do the discovery and then discard/replace that database withRootDatabase
, which then requires thecargo_metadata
loading to be performed a second time on that new db.